﻿// 2023/5/12: 首个版本

#ifndef ETHERNET_PARSER_H
#define ETHERNET_PARSER_H

#include "spadas.h"

namespace eth_parser
{
	using namespace spadas;

	class EthernetParser
	{
	public:
		static Bool parse(Binary& rawPacket, UInt channel, Array<BusChannelType>& typeHints, BusChannelType& type, UInt& id);
		static Bool parseDirectly(Binary& rawPacket, BusChannelType type, UInt& id);

	private:
		static Word parseBigEndianWord(Byte *rawData, UInt offset);
		static UInt parseBigEndianUInt(Byte *rawData, UInt offset);
		static Bool parseSomeIP(Byte *rawData, UInt rawSize, UInt& someIPStartIndex);
	};
}

#endif